<?php
use yii\helpers\Url;
use yii\helpers\Html;
use yii\bootstrap\Modal;
use kartik\grid\GridView;
use johnitvn\ajaxcrud\CrudAsset; 
use johnitvn\ajaxcrud\BulkButtonWidget;
use yii\web\View;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\TaozhuangSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Taozhuangs');
$this->params['breadcrumbs'][] = $this->title;
 
?>
<style type="text/css">
	.taozhuang-index{
		position:absolute;
		left:0px;
		width:100%;
		height:100%;
	}
	.menu_with{
	    width:80px;
	}
	#div_menu{
		float:left;
    }
    .image_tree{
	   float:left;
    	margin-left:20px;
    }
</style>
<link href="../web/css/bootstrap.min.css" rel="stylesheet">
<link href="../web/css/style.css" rel="stylesheet">
<script type="text/javascript" src="../web/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
//用于树状图 
$(function(){
    $('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch');
    $('.tree li.parent_li > span').on('click', function (e) {
        var children = $(this).parent('li.parent_li').find(' > ul > li');
        if (children.is(":visible")) {
            children.hide('fast');
            $(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
        } else {
            children.show('fast');
            $(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
        }
        e.stopPropagation();
    });
});

//模糊查询套装
 function search_tz(){
	 var tzname=$("#tzname").val();
	 if(tzname==""){
		 alert("请输入套装名称再查询！");
	 }else{
		 $.ajax({url:"index.php?r=taozhuang-new/search&tzname="+tzname ,
					 data:{},
					 success:function(data){
    					 var obj = JSON.parse(data); 
    					 var code=obj.code;
     					 if(code==1){
         					 //清空下拉框
          					$("#tzlist").html("&nbsp; &nbsp; 选择套装ID:<select style='width:150px;'>");
         					 //重新生成数据
     	 					 var count=obj.count;
    						for(var i=0;i<count;i++){
    							$("select").append("<option value='"+obj.tz[i].sid+"'>"+obj.tz[i].sid+": "+obj.tz[i].name+"</option>");
    					    }
   	 					    
     	 			     }else if(code==2){
      	 			    	$("#tzlist").html("&nbsp; &nbsp; 选择套装ID:<select style='width:150px;'> </select>");
         	 			 }
				  },	
				  error: function(){
					         alert("Error!");
			     }
		 });
	 }

}
// 显示菜单
 function show_menu(){
     $("#div_index").hide();
     $("#div_menu").show();
     $("#tree_left").show();
     $("#tree_right").show();
}
 //隐藏菜单
 function hide_menu(){
	 $("#div_menu").hide();
	 $("#tree_left").hide();
	 $("#tree_right").hide();
     $("#div_index").show();
 }
 
 //图片管理
 function show_image_tree(){
	 $("#div_image_tree").show();
}
</script>
<div id="div_index">
 
&nbsp; &nbsp;  <button onclick="show_menu();">其他后台 </button>  &nbsp;&nbsp;     <button>选中套装VR编辑上传</button> <br/><br/> 
 
<!-- 套装列表 下拉框 -->
    <div style="height:50px;" id="tzlist">
    		&nbsp; &nbsp; 选择套装ID: 
                <select  style="width:150px;">
         		<?php for($i=0;$i<count($tzlist);$i++):?>
         		 <option value="<?=$tzlist[$i]["sid"]?>"><?=$tzlist[$i]["sid"]?>:<?=$tzlist[$i]["name"]?></option>
         		<?php endfor;?>	
         		  </select>
    </div>  

    &nbsp; &nbsp; <span>输入过滤套装名 <input  style='width:150px;' type="text" id="tzname" /></span> 		
    <button onclick="search_tz();">确定</button>  

<br/><br/>
&nbsp; &nbsp;<button>编辑套装</button>&nbsp; &nbsp; <button>水平翻转</button>
</div> 
<!-- 菜单 -->
<div id="div_menu" style="display:none;" >

<button class="menu_with" onclick="hide_menu();">关闭</button><br/><br/>
<button class="menu_with" onclick="show_image_tree();">图片管理</button><br/><br/>
<button class="menu_with">套装管理</button><br/><br/>
<button class="menu_with">秀家管理</button><br/><br/>
<button class="menu_with">DIY模板</button><br/><br/>
</div>

 
     
<!--操作图片按钮  -->
<div  id="div_image_tree" class="image_tree" style="display:none;width:1500px;">
	<!-- 树状图 -->
	<div id="tree_left" style="width:300px;float:left;">
    	<div class="tree well"  >
            <ul>
             <!--新套装开始 -->
            	<li>
            		<span><i class="icon-folder-open"></i>新套装</span> 
            		<?php for($a=0;$a<count($newtaozhuang_list2);$a++):?>
            		<ul>
            			<li>
            				<span><i class="icon-minus-sign"></i> <?=$newtaozhuang_list2[$a]["typename"]?></span> 
            				<?php for($b=0;$b<count($newtaozhuang_list2[$a]["child"]);$b++):?>
            				<ul>
            					
            					<?php if(count($newtaozhuang_list2[$a]["child"][$b]["child"])>0):?>
            							 <li>
                                            <span><i class="icon-minus-sign"></i> <?=$newtaozhuang_list2[$a]["child"][$b]["typename"]?></span> <a href=""></a>
                                            
                                            <?php for($c=0;$c<count($newtaozhuang_list2[$a]["child"][$b]["child"]);$c++):?>
                                            <ul>
                                                 <li>
                                                            <span><i class="icon-leaf" style="width:120px;background-image:none!important;" ><?=$newtaozhuang_list2[$a]["child"][$b]["child"][$c]["typename"]?></i></span> <a href=""></a>
                                                  </li>
                                             </ul>
                                         
                              				 <?php endfor;?>
                              				
 										</li>
            					<?php else:?>
            							<?php if(key_exists("typename", $newtaozhuang_list2[$a]["child"][$b])):?>
            										<li>
                                						<span><i class="icon-leaf"></i> <?=$newtaozhuang_list2[$a]["child"][$b]["typename"]?></span> 
                                					</li>
            					
            							<?php endif;?>
            						
            					<?php endif;?>

            				</ul>
            				<?php endfor;?>
            			</li>
            			 
            		</ul>
            		<?php endfor;?>
            	</li>
                <!--新套装end -->
            	<!-- 秀家开始 -->
            	<li>
            		<span><i class="icon-folder-open"></i>秀家</span> 
            			<?php for($a=0;$a<count($xiujia_list2);$a++):?>
            		<ul>
            			<li>
            				<span><i class="icon-minus-sign"></i> <?=$xiujia_list2[$a]["typename"]?></span> 
            				<?php for($b=0;$b<count($xiujia_list2[$a]["child"]);$b++):?>
            				<ul>
            					
            					<?php if(count($xiujia_list2[$a]["child"][$b]["child"])>0):?>
            							 <li>
                                            <span><i class="icon-minus-sign"></i> <?=$xiujia_list2[$a]["child"][$b]["typename"]?></span> <a href=""></a>
                                            
                                            <?php for($c=0;$c<count($xiujia_list2[$a]["child"][$b]["child"]);$c++):?>
                                            <ul>
                                                 <li>
                                                            <span><i class="icon-leaf" style="width:120px;background-image:none!important;" ><?=$xiujia_list2[$a]["child"][$b]["child"][$c]["typename"]?></i></span> <a href=""></a>
                                                  </li>
                                             </ul>
                                         
                              				 <?php endfor;?>
                              				
 										</li>
            					<?php else:?>
            								<?php if(key_exists("typename", $xiujia_list2[$a]["child"][$b]["child"])):?>
            									<li>
                            						<span><i class="icon-leaf"></i> <?=$xiujia_list2[$a]["child"][$b]["typename"]?></span> 
                            					</li>
            								<?php endif;?>
            							
            					
            					<?php endif;?>

            				</ul>
            				<?php endfor;?>
            			</li>
            			 
            		</ul>
            		<?php endfor;?>
            	</li>
            	<!-- 秀家end -->
            	<!-- 老结构开始 -->
                <li>
                		<span><i class="icon-folder-open"></i>老结构</span> 
                			<?php for($a=0;$a<count($old_list2);$a++):?>
                		<ul>
                			<li>
                				<span><i class="icon-minus-sign"></i> <?=$old_list2[$a]["typename"]?></span> 
                				<?php for($b=0;$b<count($old_list2[$a]["child"]);$b++):?>
                				<ul>
                					
                					<?php if(count($old_list2[$a]["child"][$b]["child"])>0):?>
                							 <li>
                                                <span><i class="icon-minus-sign"></i> <?=$old_list2[$a]["child"][$b]["typename"]?></span> <a href=""></a>
                                                
                                                <?php for($c=0;$c<count($old_list2[$a]["child"][$b]["child"]);$c++):?>
                                                <ul>
                                                     <li>
                                                                <span><i class="icon-leaf" style="width:120px;background-image:none!important;" ><?=$old_list2[$a]["child"][$b]["child"][$c]["typename"]?></i></span> <a href=""></a>
                                                      </li>
                                                 </ul>
                                             
                                  				 <?php endfor;?>
                                  				
     										</li>
                					<?php else:?>
                					
                								<?php if(key_exists("typename", $old_list2[$a]["child"][$b]["child"])):?>
            									<li>
                            						<span><i class="icon-leaf"></i> <?=$old_list2[$a]["child"][$b]["typename"]?></span> 
                            					</li>
            								<?php endif;?>
                					
                					<?php endif;?>
    
                				</ul>
                				<?php endfor;?>
                			</li>
                			 
                		</ul>
                		<?php endfor;?>
                	</li>
            	<!-- 老结构结束 -->
            	<!-- 分类表开始 -->
            	  <li>
                		<span><i class="icon-folder-open"></i>分类表</span> 
                			<?php for($a=0;$a<count($cateList);$a++):?>
                		<ul>
                			<li>
                				<span><i class="icon-minus-sign"></i> <?=$cateList[$a]["typename"]?></span> 
                				<?php for($b=0;$b<count($cateList[$a]["child"]);$b++):?>
                				<ul>
                					
                					<?php if(count($cateList[$a]["child"][$b]["child"])>0):?>
                							 <li>
                                                <span><i class="icon-minus-sign"></i> <?=$cateList[$a]["child"][$b]["typename"]?></span> <a href=""></a>
                                                
                                                <?php for($c=0;$c<count($cateList[$a]["child"][$b]["child"]);$c++):?>
                                                <ul>
                                                     <li>
                                                                <span><i class="icon-leaf" style="width:120px;background-image:none!important;" ><?=$cateList[$a]["child"][$b]["child"][$c]["typename"]?></i></span> <a href=""></a>
                                                      </li>
                                                 </ul>
                                             
                                  				 <?php endfor;?>
                                  				
     										</li>
                					<?php else:?>
                					
                								<?php if(key_exists("typename", $cateList[$a]["child"][$b]["child"])):?>
            									<li>
                            						<span><i class="icon-leaf"></i> <?=$cateList[$a]["child"][$b]["typename"]?></span> 
                            					</li>
            								<?php endif;?>
                					
                					<?php endif;?>
    
                				</ul>
                				<?php endfor;?>
                			</li>
                			 
                		</ul>
                		<?php endfor;?>
                	</li>
 				<!-- 分类表结束 -->
            	 
            </ul>
         </div>
	</div>
	<!-- 树状图右边按钮  -->
	<div id="tree_right"  style="float:left;margin-left:30px;width:800px;">
        <!-- 刷新树按钮  --> 
        <div style="float:left;">
         <button>刷新树</button> <span>地址：images/newtaozhuang/</span> 
         <select></select>
         </div>
         <!-- 操作图片开始 -->
        <div  style="margin-left:160px;float:left;">
            <button>查看</button><button>插入选中</button><button>添加新类型</button>
            <button>上传新图片</button><button>全部选中</button><button>删除选中图片</button><button>删除选中类别</button>
        </div>
        <!-- 操作图片end -->
         <!-- 分页开始 -->
        <div style="margin-left:405px;float:clear;">
            <br/><br/>
            <button>首页</button><button>上一页</button><button>下一页</button><button>尾页</button>
                          跳转到<input type="text"/> <button>GO</button> 根据名称过滤：<input type="text"/><button>GO</button> <br/>
        
        </div>
        <!-- 分页end -->
        <!-- 品牌过滤开始 -->
        <div style="margin-left:405px;">
         <br/>   根据单品品牌过滤:
            
            <select>
            <?php for($i=0;$i<count($brandlist);$i++):?>
            <option value="<?=$brandlist[$i]["id"]?>"><?=$brandlist[$i]["id"]?>:<?=$brandlist[$i]["name"]?></option>
            <?php endfor;?> 
            </select>
            
            <button>GO</button>
        </div>
        <!-- 品牌过滤end -->
    </div>
</div>